filechooserentry: Don't trim away the slash after directories
authorBenjamin Otte <otte@redhat.com>
Thu, 3 Nov 2011 21:05:38 +0000 (22:05 +0100)
committerBenjamin Otte <otte@redhat.com>
Fri, 16 Dec 2011 19:09:11 +0000 (20:09 +0100)
It's not necessary as the code appending the slashes checks for a slash
these days.

gtk/gtkfilechooserentry.c

index 4093bdc1a8e4ceef9aae0d2caa546e3ae683aac5..c90872cbbde1f1b71ec33d845690ba0fcd6d2cee 100644 (file)
@@ -484,18 +484,6 @@ maybe_append_separator_to_file (GtkFileChooserEntry *chooser_entry,
   return display_name;
 }
 
-static char *
-trim_dir_separator_suffix (const char *str)
-{
-  int len;
-
-  len = strlen (str);
-  if (len > 0 && G_IS_DIR_SEPARATOR (str[len - 1]))
-    return g_strndup (str, len - 1);
-  else
-    return g_strdup (str);
-}
-
 /* Determines if the completion model has entries with a common prefix relative
  * to the current contents of the entry.  Also, if there's one and only one such
  * path, stores it in unique_path_ret.
@@ -562,7 +550,7 @@ find_common_prefix (GtkFileChooserEntry *chooser_entry,
        {
          if (!*common_prefix_ret)
            {
-             *common_prefix_ret = trim_dir_separator_suffix (display_name);
+             *common_prefix_ret = g_strdup (display_name);
              *unique_file_ret = g_object_ref (file);
            }
          else